<div class="view-header">
    <!-- 查询 -->
    <div ng-show="!receipt_edit_open">
        <div class="search-shop">
            <i class="fa fa-home"></i>
            <shop-picker class="from-control"
                         shop="search_params.shop"></shop-picker>
        </div>

        <div class="search-date">
            <i class="fa fa-calendar search-date-i"></i>
            <datetimepicker class="search-date-start"
                            min-view="2"
                            end-date="search_params.date_end"
                            ng-model="search_params.date_start"></datetimepicker>

        </div>
        <div class="search-date">
            <i class="fa fa-calendar search-date-i"></i>
            <datetimepicker class="search-date-end"
                            min-view="2"
                            start-date="search_params.date_start"
                            ng-model="search_params.date_end"></datetimepicker>
        </div>
        <div class="view-header-left">
            <div class="view-header-item no-widen"
                 ng-show="!place_order_open&&!add_cover"
                 ng-click="refresh()" title="查询">
                <i class="fa fa-search"></i>
            </div>
        </div>
    </div>

    <div class="view-header-left" ng-show='receipt_edit_open'>

        <!-- receipt -->
        <div class="view-header-item no-widen color-close above-cover"
             ng-click='receipt_edit_open = !receipt_edit_open; readonly = false;receipt_invalid = false;' title="关闭"
             ng-show='receipt_edit_open && !insurance_cover'>
            <i class="fa fa-close"></i>
        </div>
        <div class="view-header-item color-close above-cover" ng-click = 'receipt_destroy();' title="作废"
             ng-show='readonly &&receipt_edit_open &&!insurance_cover'>
            <i class="fa fa-trash-o"></i> 作废结算
        </div>
        <div class="view-header-item color-check above-cover" ng-click = 'print_receipt();' title="打印结算单"
             ng-show='(forms.data.status == 8 || forms.data.status == 9 || forms.data.status == 10) &&readonly &&receipt_edit_open &&!insurance_cover'>
            <i class="fa fa-print"></i> 打印结算
        </div>

        
        



        <div class="view-header-item color-save above-cover" ng-click='forms.receipt_form.$valid?save_receipt():{}' title="保存结算单"
             ng-show='!readonly && receipt_edit_open && !insurance_cover'>
            <i class="fa fa-save" ng-show="forms.receipt_form.$valid"></i>
            <i class="fa fa-ban" ng-show="forms.receipt_form.$invalid"></i>
            {{forms.receipt_form.$invalid?'完善表单!':'保存'}}
        </div>
        <div class="view-header-item color-check above-cover" ng-click='submit_receipt()' title="核对结算"
             ng-show='readonly && receipt_edit_open && forms.data.status !=8 && forms.data.status !=9 && forms.data.status !=10  &&!insurance_cover'>
            <i class="fa fa-check"></i> 核对确认
        </div>

        <div class="view-header-item color-check above-cover" ng-click = 'open_commission();' title="填写代办委托书"
             ng-show='receipt_edit_open && !insurance_cover'>
            <i class="fa fa-edit"></i> 填写代办
        </div>
        <!--<div class="view-header-item color-check above-cover" ng-click = 'open_contract();' title="购销合同"-->
             <!--ng-show='receipt_edit_open && !insurance_cover'>-->
            <!--<i class="fa fa-file"></i> 购销合同-->
        <!--</div>-->
        <!--<div class="view-header-item color-check above-cover" ng-click = 'open_service();' title="增值服务"-->
             <!--ng-show='receipt_edit_open && !insurance_cover'>-->
            <!--<i class="fa fa-file-code-o"></i> 增值服务-->
        <!--</div>-->
        



        <div class="view-header-item color-check above-cover" style="z-index:2;"
             ng-click='select_insurance();insurance_cover = !insurance_cover' title="选择保险"
             ng-show='insurance_cover'>
            <i class="fa fa-check"></i> 选择保险
        </div>
        <div class="view-header-item color-check above-cover" style="z-index:2;"
             ng-click='jipan_item_submit()' title="选择基盘项目"
             ng-show='jipan_item_cover'>
            <i class="fa fa-check"></i> 选择基盘
        </div>

        <div class="view-header-item color-check above-cover" ng-click='after_sale_send_item_check()' title="车价内已包含项目"
             ng-show='after_sale_send_item_overlay' style="z-index:2;">
            <i class="fa fa-check"></i> 选择售后
        </div>

        <div class="view-header-item color-check above-cover" style="z-index:2;"
             ng-click='check_commission()' title="确定代办"
             ng-show='is_commission'>
            <i class="fa fa-check"></i> 确定代办
        </div>
        <div class="view-header-item color-check above-cover" style="z-index:2;"
             ng-click='print_commission()' title="打印代办"
             ng-show='is_commission'>
            <i class="fa fa-print"></i> 打印代办
        </div>

        <div class="view-header-item color-check above-cover" style="z-index:2;"
             ng-click='check_contract()' title="确定购销合同"
             ng-show='is_contract'>
            <i class="fa fa-check"></i> 确定合同
        </div>
        <div class="view-header-item color-check above-cover" style="z-index:2;"
             ng-click='check_service()' title="确定增值服务合同"
             ng-show='is_service'>
            <i class="fa fa-check"></i> 确定增值
        </div>


        <!-- <div class="view-header-item color-check above-cover" style="z-index:2;"
             ng-click='after_sale_send_item_check();' title="车价内已包含项目"
             ng-show='after_sale_send_item_overlay'>
            <i class="fa fa-check"></i> 价内包含
        </div> -->
    </div>
</div>
<div class="view-content ">
    <div ag-grid="grid" class="ag-material" style="height :100%"></div>
</div>

<div class="data-overlay" ng-show='receipt_edit_open'>
    <div class="overlay-container" ng-init="form = {}">
        <div class="overlay-header">费用结算单</div>
        <form-receipt ng-model="forms.data" form="forms.receipt_form"></form-receipt>
        <div class="invalid-overlay" ng-show="readonly">
            <div class="invalid-content" ng-show="forms.data.status == 9">已作废</div>
        </div>
        <!-- <ng-include src="'/modules/sales/receipt/receipt.inc.html'" ></ng-include> -->
    </div>
</div>

<!-- 填写代办委托书 -->
<div class="data-overlay" ng-show='is_commission' style="z-index:1;">
    <div class="overlay-container" ng-init="form = {}">
        <div class="overlay-header">代办委托书</div>
        <form name="form.receipt_commission" novalidate="novalidate" >
            <ng-include src="'/modules/sales/receipt/receipt.commission.html'"></ng-include>
        </form>
        <!-- <ng-include src="'/modules/sales/receipt/receipt.inc.html'" ></ng-include> -->
    </div>
</div>
<div>
    <ng-include src="'/modules/sales/receipt/receipt.commission.print.html'"></ng-include>
</div>


<!-- 保险种类选择 -->
<!-- <div class="data-overlay invalid-container" ng-show="readonly">
    <div class="invalid-content">已作废</div>
</div> -->
<div class="data-overlay" ng-show='insurance_cover' style="z-index:1;">
    <div class="overlay-container">
        <div class="overlay-header">选择保险</div>
        <div ng-form name="form_insurance" novalidate="novalidate">
            <div class="overlay-content">
                <div class="overlay-column">
                    <div class="overlay-item" ng-repeat="item in insurance_item_data">
                        <span>{{item.type}}</span>
                        <span ng-repeat="_item in item.data">
                            <input type="radio" name="{{_item.type}}" ng-checked="_item.checked"
                                   ng-click="radio_change(_item,item.data)">
                            {{_item.name}}
                        </span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div>
    <ng-include src="'/modules/sales/receipt/receipt.print.html'"></ng-include>
</div>

<!-- 基盘项目选择 -->
<div class="data-overlay" ng-show='jipan_item_cover' style="z-index:1;">
    <div class="overlay-container">
        <div class="overlay-header">选择基盘项目</div>
        <div ng-form name="form_jipan" novalidate="novalidate">
            <div class="overlay-content">
                <div class="overlay-column overlay-column-3">
                    <div class="overlay-item">
                        <span>基盘项目：</span>
                        <select ng-model="jipan_params" ng-options="(item.name + '--' + item.amount) for item in jipan_item_shop">
                            
                        </select>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 车价内已包含项目选择 -->
<div class="data-overlay" ng-show='after_sale_send_item_overlay' style="z-index:1;">
    <div class="overlay-container">
        <div class="overlay-header">车价内已包含项目</div>
        <div name="form_after_sale" novalidate="novalidate">
            <div class="overlay-content">
                <div class="overlay-column overlay-column-3">
                    <div class="overlay-item" ng-repeat="item in after_sale_send_item_params">
                        <label style="cursor: pointer;">
                            <input type="checkbox" ng-model="item.checked" ng-change="after_sale_send_item_change(item)" ng-checked="item.checked">
                            {{item.name}}
                        </label>
                        <input type="number" placeholder='请输入价格...' ng-model="item.price" ng-show="item.checked" name="price" ng-required="true">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- 购销合同 -->
<div class="data-overlay" ng-show='is_contract' style="z-index:1;">
    <div class="overlay-container" ng-init="form = {}" style="overflow: auto;">
        <form name="form.contract_form" novalidate="novalidate" >
            <ng-include src="'/modules/sales/receipt/receipt.contract.html'"></ng-include>
        </form>
    </div>
</div>

<!-- 增值服务委托合同 -->
<div class="data-overlay" ng-show='is_service' style="z-index:1;">
    <div class="overlay-container" ng-init="form = {}" style="overflow: auto;">
        <form name="form.contract_form" novalidate="novalidate" >
            <ng-include src="'/modules/sales/receipt/receipt.service.html'"></ng-include>
        </form>
    </div>
</div>